diff options
| author | real-zephex <[email protected]> | 2024-04-13 09:42:25 +0530 |
|---|---|---|
| committer | real-zephex <[email protected]> | 2024-04-13 09:42:25 +0530 |
| commit | 9444f1162ff40842afe1c2a01cf0a32db19a6376 (patch) | |
| tree | cf0b51014fb42c83e062e7a22b0d0ea44d7888ff /src/app/anime/[id] | |
| parent | minor fixes (diff) | |
| download | dramalama-9444f1162ff40842afe1c2a01cf0a32db19a6376.tar.xz dramalama-9444f1162ff40842afe1c2a01cf0a32db19a6376.zip | |
feature added: anime history is now stored locally on the device.
Diffstat (limited to 'src/app/anime/[id]')
| -rw-r--r-- | src/app/anime/[id]/buttons.jsx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/app/anime/[id]/buttons.jsx b/src/app/anime/[id]/buttons.jsx index eac1884..dd49d6e 100644 --- a/src/app/anime/[id]/buttons.jsx +++ b/src/app/anime/[id]/buttons.jsx @@ -10,8 +10,10 @@ import { PlyrLayout, plyrLayoutIcons, } from "@vidstack/react/player/layouts/plyr"; +import { storeLocal } from "../history/storeData"; export default function Button({ data2: info }) { + const currentDate = new Date(); const [videoLink, setVideoLink] = useState(null); async function video(id) { @@ -20,10 +22,26 @@ export default function Button({ data2: info }) { alert("Sorry, but not links were found"); } else { setVideoLink(link); - console.log(videoLink); } } + function store_to_local(name, image, episode, id) { + let newData = { + name: name, + image: image, + episode: episode, + id: id, + type: "anime", + date: `${currentDate.getDate()}-${String( + currentDate.getMonth() + 1 + ).padStart(2, "0")}`, + time: `${currentDate.getHours()}:${String( + currentDate.getMinutes() + ).padStart(2, "0")}`, + }; + storeLocal(newData); + } + return ( <main> <h2 className={styles.buttonHeader}>Episodes: </h2> @@ -38,6 +56,12 @@ export default function Button({ data2: info }) { event.target.style.backgroundColor = "var(--soft-purple)"; video(item.id); + store_to_local( + info.title, + info.image, + item.number, + info.id + ); }} > {item.number} |